import request from "@/utils/request";
import { ResponseData } from "@/types/home/type";
enum API {
  MANAGE_LIST = '/manage/list',
  MANAGE_LIST_ITEM = '/manage/get',
  MANAGE_LIST_ITEM_V2 = '/manage/getv2',
  MANAGE_LIST_ADD = '/manage/add',
  MANAGE_LIST_UPDATE = '/manage/update',
  MANAGE_LIST_ADD_V2 = '/manage/addv2',
  MANAGE_LIST_UPDATE_V2 = '/manage/updatev2',
  MANAGE_LIST_DATA = '/manage/databyapid',
  MANAGE_LIST_DATA_APPID_DATE_STAGE = '/toufang/bi/getdatabyappid',
  MANAGE_LIST_DATA_APPID_DATE_STAGE_V2 = '/toufang/bi/getdatabyappidv2',
}

// 获取manage list数据 
export const reqManagelist = (params: any) => {
  const targetParams = { params }
  return request.get<any, ResponseData>(API.MANAGE_LIST, targetParams)
}

// 获取manage list data 数据 by appid
export const reqManagelistData = (params: any) => {
  const targetParams = { params }
  return request.get<any, ResponseData>(API.MANAGE_LIST_DATA, targetParams)
}
/* 
  获取manage list data 数据 by appid 和 时间区间 
  @params
  btime
  etime
  appid
*/
export const reqManagelistDataByAppidAndDateStage = (params: any) => {
  const targetParams = { params }
  return request.get<any, ResponseData>(API.MANAGE_LIST_DATA_APPID_DATE_STAGE, targetParams)
}

/* 
  获取manage list data 数据 by appid 和 时间区间  v2
  @params
  btime
  etime
  appid
*/
export const reqManagelistDataByAppidAndDateStageV2 = (params: any) => {
  const targetParams = { params }
  return request.get<any, ResponseData>(API.MANAGE_LIST_DATA_APPID_DATE_STAGE_V2, targetParams)
}

// 获取单独的manage list数据 
export const reqManagelistItem = (params: any) => {
  const targetParams = { params }
  return request.get<any, ResponseData>(API.MANAGE_LIST_ITEM, targetParams)
}


// 获取单独的manage list数据 v2
export const reqManagelistItemV2 = (params: any) => {
  const targetParams = { params }
  return request.get<any, ResponseData>(API.MANAGE_LIST_ITEM_V2, targetParams)
}

// 添加
export const reqManagelistAdd = (params: any) => {
  const targetParams = { params }
  return request.post<any, ResponseData>(API.MANAGE_LIST_ADD, {}, targetParams)
}

// 添加v2
export const reqManagelistAddV2 = (data: any) => {
  return request.post<any, ResponseData>(API.MANAGE_LIST_ADD_V2, data)
}

// 更新
export const reqManagelistUpdate = (params: any) => {
  const targetParams = { params }
  return request.post<any, ResponseData>(API.MANAGE_LIST_UPDATE, {}, targetParams)
}

// 更新v2
export const reqManagelistUpdateV2 = (data: any) => {
  return request.post<any, ResponseData>(API.MANAGE_LIST_UPDATE_V2, data)
}


